package test.eleven;

import java.util.Iterator;

public class IterrableClass implements Iterable<String>{
	protected String[] words="And thats how we know the earth to be banana-shaped".split(" ");
	
	
	@Override
	public Iterator<String> iterator() {
		return new Iterator<String>() {
			private int index=0;
			public boolean hasNext(){
				return index<words.length;
			}
			public String next(){
				return words[index++];
			}
			public void remove() {
				throw new UnsupportedOperationException();
			}
		};
	}
	
	public static void main(String[] args) {
		for(String s:new IterrableClass()){
			System.out.print(s+" ");
		}
	}
}
